/**
 * @param {number[]} nums
 * @return {number}
 */
var findMin = function(nums) {
    let length = nums.length;
    if(length===0)return null;
    if(length===1)return nums[0];

    let s = 0, e = length-1;
    while(s<e-1){
        //console.log(s,e,nums[s],nums[e]);
        if(nums[s]<nums[e]){
            return nums[s];
        }
        let m = Math.floor((s+e)/2);
        if(nums[s]<nums[m]){
            s = m;
        }else if(nums[s]>nums[m]){
            e = m;
        }else{
            s++;//如果数组元素可以重复，则使用这句
        }
    }
    return Math.min(nums[s], nums[e]);

};


console.log(findMin([10,1,10,10,10]));

//向下取整
console.log("按位或",1.9|0);
console.log("两次按位求反",~~1.9);
console.log("右移>>",1.9>>0);
console.log("直接取整",parseInt(1.9));
console.log("floor",Math.floor(1.9));